from django.shortcuts import render
from django.http import *


# Create your views here.
# def send_mail(request):
#     from django.core.mail import send_mail, send_mass_mail
#     from advance_view import settings
#     rec_li = ["178320369@qq.com"]
#     message = "快点敲代码啊憨批" \
#               "再不敲真的跟不上了"
#     try:
#
#         send_mail(subject="django学习测试专用", message=message, from_email=settings.EMAIL_FROM,
#                   recipient_list=rec_li)
#     except Exception as e:
#         return HttpResponse(e)  # 如果发送邮件异常，返回错误信息。
#     else:
#         return HttpResponse('发送成功')
def send_mail(request):
    from django.core.mail import send_mail, send_mass_mail
    from advance_view.settings import EMAIL_FROM
    rec_li = ["178320369@qq.com"]
    html_mass = "https://www.baidu.com"
    try:
        ms1 = ("django学习测试专用邮件", html_mass, EMAIL_FROM, rec_li)
        send_mass_mail((ms1,), )
    except Exception as e:
        return HttpResponse(e)  # 如果发送邮件异常，返回错误信息。
    else:
        return HttpResponse('发送成功')
